home *** CD-ROM | disk | FTP | other *** search
/ Aminet 5 / Aminet 5 - March 1995.iso / Aminet / dev / c / agl103p.lha / src / agl / RCS / window.c,v < prev   
Text File  |  1994-12-08  |  32KB  |  1,599 lines

  1. head    1.2;
  2. branch    1.2.1.99;
  3. access;
  4. symbols;
  5. locks; strict;
  6. comment    @ * @;
  7.  
  8.  
  9. 1.2
  10. date    93.02.08.01.32.20;    author jason;    state Exp;
  11. branches
  12.     1.2.1.1;
  13. next    ;
  14.  
  15. 1.2.1.1
  16. date    94.03.29.05.41.32;    author jason;    state Exp;
  17. branches;
  18. next    1.2.1.2;
  19.  
  20. 1.2.1.2
  21. date    94.04.06.02.42.55;    author jason;    state Exp;
  22. branches;
  23. next    1.2.1.3;
  24.  
  25. 1.2.1.3
  26. date    94.09.13.03.53.54;    author jason;    state Exp;
  27. branches;
  28. next    1.2.1.4;
  29.  
  30. 1.2.1.4
  31. date    94.11.16.06.31.09;    author jason;    state Exp;
  32. branches;
  33. next    1.2.1.5;
  34.  
  35. 1.2.1.5
  36. date    94.11.18.07.49.22;    author jason;    state Exp;
  37. branches;
  38. next    1.2.1.6;
  39.  
  40. 1.2.1.6
  41. date    94.12.09.05.29.56;    author jason;    state Exp;
  42. branches;
  43. next    ;
  44.  
  45.  
  46. desc
  47. @initialization and window handling
  48. @
  49.  
  50.  
  51. 1.2
  52. log
  53. @Initial RCS Version
  54. @
  55. text
  56. @#define NOT_EXTERN
  57. #include"agl.h"
  58.  
  59. #define BORDERSIZEX    4    /* displace lower left for border */
  60. #define BORDERSIZEY    2
  61.  
  62. short NextWindow_Initialized=FALSE,Gfx_Initialized=FALSE;
  63. struct Library *ConsoleDevice,*DiskfontBase;
  64.  
  65.  
  66. /*******************************************************************************
  67. void    gversion(char *string)
  68.  
  69. *******************************************************************************/
  70. /*PROTOTYPE*/
  71. void gversion(char *string)
  72.     {
  73.     sprintf(string,"GLAMECS-1.0");
  74.     }
  75.  
  76.  
  77. /*******************************************************************************
  78. long    getgdesc(long inquiry)
  79.  
  80. *******************************************************************************/
  81. /*PROTOTYPE*/
  82. long getgdesc(long inquiry)
  83.     {
  84.     long value=0;
  85.  
  86.     switch(inquiry)
  87.         {
  88.         case GD_XPMAX:
  89.             value=SCREENX;
  90.             break;
  91.         case GD_YPMAX:
  92.             value=SCREENY;
  93.             break;
  94.         case GD_BITS_NORM_SNG_CMODE:
  95.             value=SCREENDEPTH;
  96.             break;
  97.         case GD_BITS_NORM_DBL_CMODE:
  98.             value=SCREENDEPTH;
  99.             break;
  100.         case GD_NVERTEX_POLY:
  101.             value=MAX_POLY_VERTS;
  102.             break;
  103.          }
  104.  
  105.     return value;
  106.     }
  107.  
  108.  
  109. /******************************************************************************
  110. void    doublebuffer(void)
  111.  
  112. ******************************************************************************/
  113. /*PROTOTYPE*/
  114. void doublebuffer(void)
  115.     {
  116.     DoubleBuffered[CurrentWid]=TRUE;
  117.     }
  118.  
  119.  
  120. /******************************************************************************
  121. void    singlebuffer(void)
  122.  
  123. ******************************************************************************/
  124. /*PROTOTYPE*/
  125. void singlebuffer(void)
  126.     {
  127.     DoubleBuffered[CurrentWid]=FALSE;
  128.     }
  129.  
  130.  
  131. /******************************************************************************
  132. long    getdisplaymode(void)
  133.  
  134.     0 = RGB single
  135.     1 = single
  136.     2 = double
  137.     5 = RGB double
  138. ******************************************************************************/
  139. /*PROTOTYPE*/
  140. long getdisplaymode(void)
  141.     {
  142.     return 1+DoubleBuffered[CurrentWid];
  143.     }
  144.  
  145.  
  146. /*******************************************************************************
  147. void    gconfig(void)
  148.  
  149. *******************************************************************************/
  150. /*PROTOTYPE*/
  151. void gconfig(void)
  152.     {
  153.     long d,dd,abort=FALSE;
  154.  
  155.     if(DoubleBuffered[CurrentWid] && !DoubleBufferSet[CurrentWid])
  156.         {
  157.         memcpy(&BackRPort[CurrentWid],GLWindow[CurrentWid]->RPort,sizeof(struct RastPort));
  158.  
  159.         InitBitMap(&BackBitMap[CurrentWid],SCREENDEPTH,SCREENX,SCREENY);
  160.         for(d=0;d<SCREENDEPTH && !abort;d++)
  161.             if((BackBitMap[CurrentWid].Planes[d]=(PLANEPTR)AllocRaster(SCREENX,SCREENY))==NULL)
  162.                 abort=TRUE;
  163.  
  164.         if(abort)
  165.             {
  166.             GL_error("Could not allocate backbuffer");
  167.  
  168.             for(dd=0;dd<d-1;dd++)
  169.                 FreeRaster(BackBitMap[CurrentWid].Planes[dd],SCREENX,SCREENY);
  170.             }
  171.         else
  172.             {
  173.             BackRPort[CurrentWid].BitMap= &BackBitMap[CurrentWid];
  174.             DoubleBufferSet[CurrentWid]=TRUE;
  175.             }
  176.         }
  177.  
  178.     if(!DoubleBuffered[CurrentWid] && DoubleBufferSet[CurrentWid])
  179.         {
  180.         for(d=0;d<SCREENDEPTH;d++)
  181.             FreeRaster(BackBitMap[CurrentWid].Planes[d],SCREENX,SCREENY);
  182.  
  183.         DoubleBufferSet[CurrentWid]=FALSE;
  184.         }
  185.  
  186.     set_rasterport();
  187.     }
  188.  
  189.  
  190. /*******************************************************************************
  191. void    swapbuffers(void)
  192.  
  193. *******************************************************************************/
  194. /*PROTOTYPE*/
  195. void swapbuffers(void)
  196.     {
  197.     if(DoubleBuffered[CurrentWid])
  198.         {
  199. /*
  200.         OwnBlitter();
  201.         WaitBlit();
  202.         BltBitMap(DrawRPort->BitMap,0,0,VisibleRPort->BitMap,0,0,CurrentWidth,CurrentHeight,0xC0,0xFF,NULL);
  203.         DisownBlitter();
  204. */
  205.         ClipBlit(DrawRPort,0,0,VisibleRPort,0,0,CurrentWidth,CurrentHeight,0xC0);
  206.         }
  207. /*
  208.     else
  209.         GL_error("swapbuffers() called in single buffer mode");
  210. */
  211.     }
  212.  
  213.  
  214. /*******************************************************************************
  215. void    set_rasterport(void)
  216.  
  217. *******************************************************************************/
  218. /*PROTOTYPE*/
  219. void set_rasterport(void)
  220.     {
  221.     VisibleRPort=GLWindow[CurrentWid]->RPort;
  222.  
  223.     if(DoubleBuffered[CurrentWid])
  224.         DrawRPort= &BackRPort[CurrentWid];
  225.     else
  226.         DrawRPort=VisibleRPort;
  227.     }
  228.  
  229.  
  230. /*******************************************************************************
  231. void    winpush(void)
  232.  
  233. *******************************************************************************/
  234. /*PROTOTYPE*/
  235. void winpush(void)
  236.     {
  237.     WindowToBack(GLWindow[CurrentWid]);
  238.     }
  239.  
  240.  
  241. /*******************************************************************************
  242. void    winpop(void)
  243.  
  244. *******************************************************************************/
  245. /*PROTOTYPE*/
  246. void winpop(void)
  247.     {
  248.     WindowToFront(GLWindow[CurrentWid]);
  249.     }
  250.  
  251.  
  252. /*******************************************************************************
  253. long    winget(void)
  254.  
  255. *******************************************************************************/
  256. /*PROTOTYPE*/
  257. long winget(void)
  258.     {
  259.     return CurrentWid;
  260.     }
  261.  
  262.  
  263. /*******************************************************************************
  264. void    winset(long wid)
  265.  
  266. *******************************************************************************/
  267. /*PROTOTYPE*/
  268. void winset(long wid)
  269.     {
  270.     static char string[100];
  271.  
  272.     if(GLWindow[wid]==NULL)
  273.         {
  274.         if(wid)
  275.             {
  276.             sprintf(string,"winset(%d): window not open",wid);
  277.             GL_error(string);
  278.             }
  279.  
  280.         CurrentWid=0;
  281.         }
  282.     else
  283.         {
  284.         CurrentWid=wid;
  285.  
  286.         set_rasterport();
  287.         get_dimensions(CurrentWid,&CurrentPosX,&CurrentPosY,&CurrentWidth,&CurrentHeight);
  288.         }
  289.     }
  290.  
  291.  
  292. /******************************************************************************
  293. short    get_dimensions(long wid,long *x,long *y,long *lenx,long *leny)
  294.  
  295.     returns 0 if window is not opened
  296. ******************************************************************************/
  297. /*PROTOTYPE*/
  298. short get_dimensions(long wid,long *x,long *y,long *lenx,long *leny)
  299.     {
  300.     if(GLWindow[wid]==NULL)
  301.         return 0;
  302.  
  303.     if(GLWindow[wid]->Flags & BORDERLESS)
  304.         {
  305.         *lenx=GLWindow[wid]->Width;
  306.         *leny=GLWindow[wid]->Height;
  307.         }
  308.     else
  309.         {
  310.         *lenx=GLWindow[wid]->GZZWidth;
  311.         *leny=GLWindow[wid]->GZZHeight;
  312.         }
  313.  
  314.     *x=GLWindow[wid]->LeftEdge+GLWindow[wid]->BorderLeft;
  315.     *y=GLWindow[wid]->TopEdge+GLWindow[wid]->BorderTop;
  316.  
  317.     *y=SCREENY-1-(*y)- *leny;
  318.  
  319.     return 1;
  320.     }
  321.  
  322.  
  323. /*******************************************************************************
  324. void    sleep(long seconds)
  325.  
  326. *******************************************************************************/
  327. /*PROTOTYPE*/
  328. void sleep(long seconds)
  329.     {
  330.     Delay(60*seconds);
  331.     }
  332.  
  333.  
  334. /*******************************************************************************
  335. void    micropause(void)
  336.  
  337. *******************************************************************************/
  338. /*PROTOTYPE*/
  339. void micropause(void)
  340.     {
  341.     Delay(5);
  342.     }
  343.  
  344.  
  345. /*******************************************************************************
  346. void    prefposition(long x1,long x2,long y1,long y2)
  347.  
  348. *******************************************************************************/
  349. /*PROTOTYPE*/
  350. void prefposition(long x1,long x2,long y1,long y2)
  351.     {
  352.     if(!NextWindow_Initialized)
  353.         initialize_nextwindow();
  354.  
  355.     NextWindow.LeftEdge=x1;
  356.     NextWindow.Width=    x2-x1+1;
  357.  
  358.     NextWindow.TopEdge=    SCREENY-1-y2;
  359.     NextWindow.Height=    y2-y1+1;
  360.  
  361. /*
  362. printf("X %3d   %3d  Y %3d   %3d\n",x1,x2,y1,y2);
  363. printf("L %3d W %3d  T %3d H %3d\n\n",NextWindow.LeftEdge,NextWindow.Width,
  364.                                                                     NextWindow.TopEdge,NextWindow.Height);
  365. */
  366.     }
  367.  
  368.  
  369. /*******************************************************************************
  370. void    noborder(void)
  371.  
  372. *******************************************************************************/
  373. /*PROTOTYPE*/
  374. void noborder(void)
  375.     {
  376.     if(!NextWindow_Initialized)
  377.         initialize_nextwindow();
  378.  
  379.     NextWindow.Flags|=BORDERLESS;
  380.     }
  381.  
  382.  
  383. /******************************************************************************
  384. void    winposition(long x1,long x2,long y1,long y2)
  385.  
  386. ******************************************************************************/
  387. /*PROTOTYPE*/
  388. void winposition(long x1,long x2,long y1,long y2)
  389.     {
  390.     long lenx,leny;
  391.  
  392.     lenx=abs(x2-x1);
  393.     leny=abs(y2-y1);
  394.  
  395.     if(x1>x2)
  396.         x1=x2;
  397.     if(y1>y2)
  398.         y1=y2;
  399.  
  400.     winmove(x1,y1);
  401.     SizeWindow(GLWindow[CurrentWid],lenx,leny);
  402.     }
  403.  
  404.  
  405. /******************************************************************************
  406. void    winmove(long orgx,long orgy)
  407.  
  408. ******************************************************************************/
  409. /*PROTOTYPE*/
  410. void winmove(long orgx,long orgy)
  411.     {
  412.     long dx,dy;
  413.  
  414.     dx=orgx-CurrentPosX;
  415.     dy=orgy-CurrentPosY;
  416.  
  417.     MoveWindow(GLWindow[CurrentWid],dx,-dy);
  418.     }
  419.  
  420.  
  421. /******************************************************************************
  422. void    wintitle(char *name)
  423.  
  424. ******************************************************************************/
  425. /*PROTOTYPE*/
  426. void wintitle(char *name)
  427.     {
  428.     strcpy(TitleList[CurrentWid],name);
  429.     }
  430.  
  431.  
  432. /******************************************************************************
  433. void    getsize(long *x,long *y)
  434.  
  435. ******************************************************************************/
  436. /*PROTOTYPE*/
  437. void getsize(long *x,long *y)
  438.     {
  439.     *x=CurrentWidth;
  440.     *y=CurrentHeight;
  441.     }
  442.  
  443.  
  444. /******************************************************************************
  445. void    getorigin(long *x,long *y)
  446.  
  447. ******************************************************************************/
  448. /*PROTOTYPE*/
  449. void getorigin(long *x,long *y)
  450.     {
  451.     *x=CurrentPosX;
  452.     *y=CurrentPosY;
  453.     }
  454.  
  455.  
  456. /*******************************************************************************
  457. long    winopen(char *title)
  458.  
  459. *******************************************************************************/
  460. /*PROTOTYPE*/
  461. long winopen(char *title)
  462.     {
  463.     long wid=1;
  464.  
  465.     if(!NextWindow_Initialized)
  466.         initialize_nextwindow();
  467.  
  468.     while(wid<MAX_WINDOWS && GLWindow[wid])
  469.         wid++;
  470.  
  471.     if(wid==MAX_WINDOWS)
  472.         {
  473.         GL_error("Too many windows");
  474.         return -1;
  475.         }
  476.  
  477.     if(!Gfx_Initialized)
  478.         gfxinit();
  479.  
  480.     DefaultWindow.Screen=GLScreen;
  481.     NextWindow.Screen=GLScreen;
  482.  
  483.     if( !(NextWindow.Flags & BORDERLESS) )
  484.         {
  485.         NextWindow.Flags|= ACTIVATE | WINDOWDRAG | WINDOWCLOSE | GIMMEZEROZERO;
  486.         NextWindow.Title=TitleList[wid];
  487.         strcpy(NextWindow.Title,title);
  488.  
  489.         NextWindow.LeftEdge-=BORDERSIZEX;
  490.         NextWindow.TopEdge+=BORDERSIZEY;
  491.         }
  492.  
  493.     GLWindow[wid]=(struct Window *)OpenWindow(&NextWindow);
  494.     if(GLWindow[wid]==NULL)
  495.          {
  496.          printf("Window won't open\n");
  497.          CloseScreen(GLScreen);
  498.          CloseLibrary((void *)IntuitionBase);
  499.          CloseLibrary((void *)GfxBase);
  500.          exit(400);
  501.          }
  502.  
  503.     winset(wid);
  504.  
  505.     InitArea(&AInfo[wid],AreaBuffer[wid],MAX_POLY_VERTS);
  506.     DrawRPort->AreaInfo= &AInfo[wid];
  507.     TempBuffer[wid]=(PLANEPTR)AllocRaster(SCREENX,SCREENY);
  508.     if(TempBuffer[wid]==NULL)
  509.         {
  510.         GL_error("Error alocating Poly Space");
  511.         return -1;
  512.         }
  513.     DrawRPort->TmpRas=
  514.             (struct TmpRas *)InitTmpRas(&TempRaster[wid],TempBuffer[wid],RASSIZE(SCREENX,SCREENY));
  515.  
  516.     SetDrMd(DrawRPort,JAM1);
  517.     OneToOne[wid]=TRUE;
  518.     Dimensions[wid]=2;
  519.  
  520.     initialize_nextwindow();
  521.  
  522.     return wid;
  523.     }
  524.  
  525.  
  526. /*******************************************************************************
  527. void    winclose(long wid)
  528.  
  529. *******************************************************************************/
  530. /*PROTOTYPE*/
  531. void winclose(long wid)
  532.     {
  533.     char string[100];
  534.     long temp_wid;
  535.     short m,on;
  536.  
  537.     if(GLWindow[wid]==NULL)
  538.         {
  539.         sprintf(string,"cannot close unopened window %d",wid);
  540.         GL_error(string);
  541.         }
  542.     else
  543.         {
  544.         /* remove backbuffer */
  545.         temp_wid=CurrentWid;
  546.  
  547.         winset(wid);
  548.         singlebuffer();
  549.         gconfig();
  550.  
  551.         if(GLWindow[temp_wid])
  552.             winset(temp_wid);
  553.  
  554.         FreeRaster(TempBuffer[wid],SCREENX,SCREENY);
  555.  
  556.         CloseWindow(GLWindow[wid]);
  557.         GLWindow[wid]=NULL;
  558.         }
  559.  
  560.     on=0;
  561.     for(m=1;m<MAX_WINDOWS;m++)
  562.         if(GLWindow[m])
  563.             on=1;
  564.  
  565.     if(!on)
  566.         {
  567. #if MICE
  568.         free_mousesprite();
  569.         stop_gameport();
  570. #endif
  571.  
  572.         CloseFont(FontPtr);
  573.          CloseLibrary((void *)DiskfontBase);
  574.  
  575.         CloseScreen(GLScreen);
  576.          CloseLibrary((void *)IntuitionBase);
  577.          CloseLibrary((void *)GfxBase);
  578.         }
  579.     }
  580.  
  581.  
  582. /*******************************************************************************
  583. void    initialize_nextwindow(void)
  584.  
  585. *******************************************************************************/
  586. /*PROTOTYPE*/
  587. void initialize_nextwindow(void)
  588.     {
  589.     static short first=1;
  590.     short m;
  591.  
  592.     if(first)
  593.         {
  594.         for(m=0;m<MAX_WINDOWS;m++)
  595.             {
  596.             GLWindow[m]=NULL;
  597.             DoubleBuffered[m]=0;
  598.             DoubleBufferSet[m]=0;
  599.             }
  600.  
  601.         first=0;
  602.         }
  603.  
  604.     memcpy(&NextWindow,&DefaultWindow,sizeof(struct NewWindow));
  605.  
  606.     NextWindow_Initialized=TRUE;
  607.     }
  608.  
  609.  
  610. /*******************************************************************************
  611. void    gfxinit(void)
  612.  
  613. *******************************************************************************/
  614. /*PROTOTYPE*/
  615. void gfxinit(void)
  616.     {
  617.     GfxBase=(struct GfxBase *)OpenLibrary("graphics.library",0L);
  618.     if(GfxBase==NULL)
  619.          {
  620.         GL_error("Error opening GraFiX Library\n");
  621.  
  622.          exit(1);
  623.          }
  624.  
  625.     IntuitionBase=(struct IntuitionBase *)OpenLibrary("intuition.library",0L);
  626.     if(IntuitionBase==NULL)
  627.          {
  628.         GL_error("Error opening Intuition Library\n");
  629.  
  630.          CloseLibrary((void *)GfxBase);
  631.          exit(2);
  632.          }
  633.  
  634.     GLScreen=(struct Screen *)OpenScreen(&ScreenDef);
  635.     if(GLScreen==NULL)
  636.          {
  637.         GL_error("Error opening Screen\n");
  638.  
  639.          CloseLibrary((void *)IntuitionBase);
  640.          CloseLibrary((void *)GfxBase);
  641.          exit(3);
  642.          }
  643.  
  644.     if(!(OpenDevice("console.device",-1L,(struct IORequest *)&IOStandardRequest,0L)))
  645.         ConsoleDevice=(struct Library *)IOStandardRequest.io_Device;
  646.     else
  647.         {
  648.         GL_error("Error Opening Console\n");
  649.  
  650.          CloseScreen(GLScreen);
  651.          CloseLibrary((void *)IntuitionBase);
  652.          CloseLibrary((void *)GfxBase);
  653.          exit(4);
  654.         }
  655.  
  656.     DiskfontBase=OpenLibrary("diskfont.library",0L);
  657.     if(DiskfontBase==NULL)
  658.         GL_error("Error opening Diskfont Library\n");
  659.  
  660.     FontPtr=OpenDiskFont(&StdFont);
  661.     if(FontPtr==NULL)
  662.         GL_error("Error Opening Font\n");
  663.  
  664. /*     SetRast(&GLScreen->RastPort,BLUEGREEN); */
  665.  
  666.     GLView= &GLScreen->ViewPort;
  667.     LoadRGB4(GLView,ColorMap,16);
  668.     DrawType=FALSE;
  669.     CurrentColor=0;
  670.     init_matrices();
  671.  
  672. #if MICE
  673.     start_gameport();
  674.     create_mousesprite();
  675. #endif
  676.  
  677.     qinit();
  678.  
  679.     Gfx_Initialized=TRUE;
  680.     }
  681.  
  682.  
  683. /*******************************************************************************
  684. void    GL_error(char *message)
  685.  
  686. *******************************************************************************/
  687. /*PROTOTYPE*/
  688. void GL_error(char *message)
  689.     {
  690.     printf("Amiga GL Error: %s\n",message);
  691.     }
  692. @
  693.  
  694.  
  695. 1.2.1.1
  696. log
  697. @Added RCS Header
  698. @
  699. text
  700. @a0 16
  701.  
  702. /******************************************************************************
  703.  
  704. $Id: window.c,v 1.2.1.1 2002/03/26 22:04:26 jason Exp jason $
  705.  
  706. $Log: window.c,v $
  707.  * Revision 1.2.1.1  2002/03/26  22:04:26  jason
  708.  * Added RCS Header
  709.  *
  710.  * Revision 1.2.1.1  2002/03/26  22:00:51  jason
  711.  * RCS/agl.h,v
  712.  *
  713.  
  714. ******************************************************************************/
  715.  
  716.  
  717. d34 1
  718. a34 1
  719.             value=ScreenDef.Width;
  720. d37 1
  721. a37 1
  722.             value=ScreenDef.Height;
  723. d40 1
  724. a40 1
  725.             value=ScreenDef.Depth;
  726. d43 1
  727. a43 1
  728.             value=ScreenDef.Depth;
  729. d104 3
  730. a106 4
  731.         InitBitMap(&BackBitMap[CurrentWid],(long)ScreenDef.Depth,(long)ScreenDef.Width,(long)ScreenDef.Height);
  732.         for(d=0;d<ScreenDef.Depth && !abort;d++)
  733.             if((BackBitMap[CurrentWid].Planes[d]=(PLANEPTR)AllocRaster((ULONG)ScreenDef.Width,
  734.                                                                     (ULONG)ScreenDef.Height))==NULL)
  735. d114 1
  736. a114 1
  737.                 FreeRaster(BackBitMap[CurrentWid].Planes[dd],(ULONG)ScreenDef.Width,(ULONG)ScreenDef.Height);
  738. d125 2
  739. a126 2
  740.         for(d=0;d<ScreenDef.Depth;d++)
  741.             FreeRaster(BackBitMap[CurrentWid].Planes[d],(ULONG)ScreenDef.Width,(ULONG)ScreenDef.Height);
  742. d262 1
  743. a262 1
  744.     *y=ScreenDef.Height-1-(*y)- *leny;
  745. d303 1
  746. a303 1
  747.     NextWindow.TopEdge=    ScreenDef.Height-1-y2;
  748. d441 1
  749. a441 1
  750.          printf("Window won't open: \"%s\"\n",title);
  751. d452 1
  752. a452 1
  753.     TempBuffer[wid]=(PLANEPTR)AllocRaster((ULONG)ScreenDef.Width,(ULONG)ScreenDef.Height);
  754. d458 2
  755. a459 2
  756.     DrawRPort->TmpRas=(struct TmpRas *)
  757.                 InitTmpRas(&TempRaster[wid],TempBuffer[wid],RASSIZE(ScreenDef.Width,ScreenDef.Height));
  758. d499 1
  759. a499 1
  760.         FreeRaster(TempBuffer[wid],(ULONG)ScreenDef.Width,(ULONG)ScreenDef.Height);
  761. a554 53
  762. /******************************************************************************
  763. long    AGLconfig(short screenx,short screeny,short bitplanes)
  764.  
  765.     this the only AGL specific command
  766.  
  767.     it configures the screen for all windows to use
  768.  
  769.     returns TRUE if sucessful, ie. no GL command had been previously issued
  770.  
  771. ******************************************************************************/
  772. /*PROTOTYPE*/
  773. long AGLconfig(short screenx,short screeny,short bitplanes)
  774.     {
  775.     if(Gfx_Initialized)
  776.         {
  777.         GL_error("AGLconfig(): must be called before all GL commands\n");
  778.         return FALSE;
  779.         }
  780.     else
  781.         {
  782.         ScreenDef.ViewModes=NULL;
  783.  
  784.         if(bitplanes>5)
  785.             bitplanes=5;
  786.  
  787.         if(screenx>360)
  788.             {
  789.             ScreenDef.ViewModes|=HIRES;
  790.  
  791.             if(screenx>720)
  792.                 screenx=720;
  793.  
  794.             if(bitplanes>4)
  795.                 bitplanes=4;
  796.             }
  797.  
  798.         if(screeny>225)
  799.             {
  800.             ScreenDef.ViewModes|=LACE;
  801.  
  802.             if(screeny>450)
  803.                 screeny=450;
  804.             }
  805.  
  806.         ScreenDef.Width=screenx;
  807.         ScreenDef.Height=screeny;
  808.         ScreenDef.Depth=bitplanes;
  809.  
  810.         return TRUE;
  811.         }
  812.     }
  813.  
  814.  
  815. a561 4
  816.     long colors;
  817.  
  818.     colors=pow(2.0,(float)ScreenDef.Depth);
  819.  
  820. d612 1
  821. a612 1
  822.     LoadRGB4(GLView,ColorMap,colors);
  823. @
  824.  
  825.  
  826. 1.2.1.2
  827. log
  828. @winset() calls reset_matrix_pointers()
  829. @
  830. text
  831. @d4 1
  832. a4 1
  833. $Id: window.c,v 1.2.1.1 1994/03/29 05:41:32 jason Exp jason $
  834. a6 3
  835.  * Revision 1.2.1.1  1994/03/29  05:41:32  jason
  836.  * Added RCS Header
  837.  *
  838. a249 2
  839.  
  840.         reset_matrix_pointers();
  841. @
  842.  
  843.  
  844. 1.2.1.3
  845. log
  846. @use true double-buffering for single window
  847. added prefsize
  848. added minsize(), maxsize()
  849. fixed border corrections
  850. @
  851. text
  852. @d4 1
  853. a4 1
  854. $Id: window.c,v 1.2.1.2 1994/04/06 02:42:55 jason Exp $
  855. a6 3
  856.  * Revision 1.2.1.2  1994/04/06  02:42:55  jason
  857.  * winset() calls reset_matrix_pointers()
  858.  *
  859. d23 2
  860. a24 4
  861. #define BORDERSIZEX    4        /* displace lower left for border */
  862. #define BORDERSIZEY    11
  863.  
  864. #define BORDERSIZE_TITLEY    12
  865. d27 1
  866. a27 3
  867. short NumberWindows=0;
  868.  
  869. struct Library *ConsoleDevice,*DiskfontBase,*LayersBase;
  870. a161 2
  871.     struct BitMap *swap;
  872.  
  873. a163 16
  874.         if(NumberWindows==1)
  875.             {
  876.             MakeScreen(GLScreen);
  877.             RethinkDisplay();
  878.  
  879.             swap=VisibleRPort->BitMap;
  880.             VisibleRPort->BitMap=DrawRPort->BitMap;
  881.             DrawRPort->BitMap=swap;
  882.  
  883.             GLScreen->RastPort.BitMap=swap;
  884.             GLScreen->ViewPort.RasInfo->BitMap=swap;
  885. /*             GLWindow[CurrentWid]->RPort->BitMap=swap; */
  886.             }
  887.         else
  888.             {
  889.             deactivate_clipping();
  890. d165 4
  891. a168 4
  892.             OwnBlitter();
  893.             WaitBlit();
  894.             BltBitMap(DrawRPort->BitMap,0,0,VisibleRPort->BitMap,0,0,CurrentWidth,CurrentHeight,0xC0,0xFF,NULL);
  895.             DisownBlitter();
  896. d170 1
  897. a170 4
  898.             ClipBlit(DrawRPort,0,0,VisibleRPort,0,0,CurrentWidth,CurrentHeight,0xC0);
  899.  
  900.             activate_clipping();
  901.             }
  902. d172 1
  903. d175 1
  904. d301 2
  905. a302 2
  906. /******************************************************************************
  907. void    minsize(long x,long y)
  908. d304 1
  909. a304 1
  910. ******************************************************************************/
  911. d306 1
  912. a306 1
  913. void minsize(long x,long y)
  914. d308 1
  915. a308 14
  916.     NextWindow.MinWidth=x;
  917.     NextWindow.MinHeight=y;
  918.     }
  919.  
  920.  
  921. /******************************************************************************
  922. void    maxsize(long x,long y)
  923.  
  924. ******************************************************************************/
  925. /*PROTOTYPE*/
  926. void maxsize(long x,long y)
  927.     {
  928.     NextWindow.MaxWidth=x;
  929.     NextWindow.MaxHeight=y;
  930. a327 3
  931.     if(NextWindow.Flags&WINDOWSIZING)
  932.         NextWindow.Flags^=WINDOWSIZING;
  933.  
  934. d329 3
  935. a331 3
  936.     printf("X %3d   %3d  Y %3d   %3d\n",x1,x2,y1,y2);
  937.     printf("L %3d W %3d  T %3d H %3d\n\n",NextWindow.LeftEdge,NextWindow.Width,
  938.                                                             NextWindow.TopEdge,NextWindow.Height);
  939. a335 13
  940. /******************************************************************************
  941. void    prefsize(long x,long y)
  942.  
  943. ******************************************************************************/
  944. /*PROTOTYPE*/
  945. void prefsize(long x,long y)
  946.     {
  947.     prefposition(BORDERSIZEX,BORDERSIZEX+x-1,1,1+y-1);
  948.  
  949.     NextWindow.Flags|=WINDOWSIZING;
  950.     }
  951.  
  952.  
  953. d457 1
  954. a457 4
  955.         NextWindow.TopEdge-=BORDERSIZEY;
  956.  
  957.         NextWindow.Height+=BORDERSIZE_TITLEY;
  958.         NextWindow.Width+=BORDERSIZEX*2;
  959. a479 1
  960.  
  961. d484 1
  962. a484 3
  963.  
  964.     ortho2(-0.5,CurrentWidth-0.5,-0.5,CurrentHeight-0.5);
  965.     viewport(0,CurrentWidth-1,0,CurrentHeight-1);
  966. a488 2
  967.     NumberWindows++;
  968.  
  969. a492 21
  970. /******************************************************************************
  971. void    kill_AGL(void)
  972.  
  973.     set as trap to occur on completion of execution
  974.  
  975.     closes all opened windows
  976.     should result in complete release of all of AGL's resources
  977. ******************************************************************************/
  978. /*PROTOTYPE*/
  979. void kill_AGL(void)
  980.     {
  981.     long m;
  982.  
  983.     printf("KILL AGL\n");
  984.  
  985.     for(m=1;m<MAX_WINDOWS;m++)
  986.         if(GLWindow[m])
  987.             winclose(m);
  988.     }
  989.  
  990.  
  991. a503 2
  992.     NumberWindows--;
  993.  
  994. d564 2
  995. a565 3
  996.             DoubleBuffered[m]=FALSE;
  997.             DoubleBufferSet[m]=FALSE;
  998.             Clipped[m]=FALSE;
  999. d568 1
  1000. a568 1
  1001.         first=FALSE;
  1002. d599 4
  1003. a602 1
  1004.         if(screeny>225)
  1005. d604 1
  1006. a604 1
  1007.             printf("HiRes Lace\n");
  1008. a608 3
  1009.             if(screeny>450)
  1010.                 screeny=450;
  1011.  
  1012. d611 1
  1013. d613 2
  1014. a614 1
  1015.             ScreenDef.ViewModes|=HIRES;
  1016. a615 6
  1017.             }
  1018.         else
  1019.             {
  1020.             printf("LoRes\n");
  1021.             if(screenx>360)
  1022.                 screenx=360;
  1023. d617 2
  1024. a618 5
  1025.             if(screeny>225)
  1026.                 screeny=225;
  1027.  
  1028.             if(bitplanes>5)
  1029.                 bitplanes=5;
  1030. a632 2
  1031.     startup AGL and initialize all it's resources
  1032.  
  1033. a657 10
  1034.     LayersBase=OpenLibrary("layers.library",0L);
  1035.     if(LayersBase==NULL)
  1036.          {
  1037.         GL_error("Error opening Intuition Library\n");
  1038.  
  1039.          CloseLibrary((void *)IntuitionBase);
  1040.          CloseLibrary((void *)GfxBase);
  1041.          exit(3);
  1042.          }
  1043.  
  1044. a662 1
  1045.          CloseLibrary((void *)LayersBase);
  1046. d665 1
  1047. a665 1
  1048.          exit(4);
  1049. a674 1
  1050.          CloseLibrary((void *)LayersBase);
  1051. d677 1
  1052. a677 1
  1053.          exit(5);
  1054. a703 4
  1055.  
  1056.     /* set an exit trap */
  1057.     if(atexit(kill_AGL))
  1058.         GL_error("Error setting exit trap\n");
  1059. @
  1060.  
  1061.  
  1062. 1.2.1.4
  1063. log
  1064. @added border support
  1065. fixed double-buffering
  1066. @
  1067. text
  1068. @d4 1
  1069. a4 1
  1070. $Id: window.c,v 1.2.1.3 1994/09/13 03:53:54 jason Exp jason $
  1071. a6 6
  1072.  * Revision 1.2.1.3  1994/09/13  03:53:54  jason
  1073.  * use true double-buffering for single window
  1074.  * added prefsize
  1075.  * added minsize(), maxsize()
  1076.  * fixed border corrections
  1077.  *
  1078. a25 2
  1079. #define COOL_BORDERS    TRUE
  1080.  
  1081. d31 1
  1082. a31 4
  1083. short NextWindow_Initialized=FALSE;
  1084. short NextBordered=TRUE;
  1085. short NextSizeable=TRUE;
  1086. short Gfx_Initialized=FALSE;
  1087. a80 22
  1088. void    cmode(void)
  1089.  
  1090. ******************************************************************************/
  1091. /*PROTOTYPE*/
  1092. void cmode(void)
  1093.     {
  1094.     RGBmodeOn[CurrentWid]=FALSE;
  1095.     }
  1096.  
  1097.  
  1098. /******************************************************************************
  1099. void    RGBmode(void)
  1100.  
  1101. ******************************************************************************/
  1102. /*PROTOTYPE*/
  1103. void RGBmode(void)
  1104.     {
  1105.     RGBmodeOn[CurrentWid]=TRUE;
  1106.     }
  1107.  
  1108.  
  1109. /******************************************************************************
  1110. a116 51
  1111. /******************************************************************************
  1112. void    clone_new_bitmap(void)
  1113.  
  1114.     if true double-buffing (single window), copy visible bitmap to drawbuffer
  1115.     intended to update window borders and screen background in backbuffer
  1116. ******************************************************************************/
  1117. /*PROTOTYPE*/
  1118. void clone_new_bitmap(void)
  1119.     {
  1120.     struct BitMap *old_bitmap;
  1121.  
  1122.     if(NumberWindows==1 && DoubleBufferSet[CurrentWid])
  1123.         {
  1124.  
  1125. #if FALSE
  1126.         BltBitMap(
  1127.                     &BackBitMap[CurrentWid],0,0,
  1128.                     GLScreen->RastPort.BitMap,0,0,
  1129.                                             (long)ScreenDef.Width,(long)ScreenDef.Height,0xC0,0xFF,NULL);
  1130.  
  1131.         old_bitmap=GLWindow[CurrentWid]->RPort->BitMap;
  1132.         memcpy(GLWindow[CurrentWid]->RPort,&BackRPort[CurrentWid],sizeof(struct RastPort));
  1133.  
  1134.         GLWindow[CurrentWid]->RPort->BitMap=old_bitmap;
  1135. #endif
  1136.  
  1137. #if FALSE
  1138.         BltBitMap(
  1139.                     GLScreen->RastPort.BitMap,0,0,
  1140.                     &BackBitMap[CurrentWid],0,0,
  1141.                                         (long)ScreenDef.Width,(long)ScreenDef.Height,0xC0,0xFF,NULL);
  1142.  
  1143.         old_bitmap=BackRPort[CurrentWid].BitMap;
  1144.         memcpy(&BackRPort[CurrentWid],GLWindow[CurrentWid]->RPort,sizeof(struct RastPort));
  1145.         BackRPort[CurrentWid].BitMap=old_bitmap;
  1146. #endif
  1147.  
  1148. #if TRUE
  1149.         BltBitMap(
  1150.                     VisibleRPort->BitMap,0,0,
  1151.                     DrawRPort->BitMap,0,0,
  1152.                                         (long)ScreenDef.Width,(long)ScreenDef.Height,0xC0,0xFF,NULL);
  1153.  
  1154.         old_bitmap=DrawRPort->BitMap;
  1155.         memcpy(DrawRPort,VisibleRPort,sizeof(struct RastPort));
  1156.         DrawRPort->BitMap=old_bitmap;
  1157. #endif
  1158.         }
  1159.     }
  1160.  
  1161.  
  1162. d130 1
  1163. a130 2
  1164.         InitBitMap(&BackBitMap[CurrentWid],(long)ScreenDef.Depth,
  1165.                                                             (long)ScreenDef.Width,(long)ScreenDef.Height);
  1166. a131 1
  1167.             {
  1168. a135 11
  1169. /*             clone_new_bitmap(); */
  1170.  
  1171.             BltBitMap(
  1172.                         GLScreen->RastPort.BitMap,0,0,
  1173.                         &BackBitMap[CurrentWid],0,0,
  1174.                                             (long)ScreenDef.Width,(long)ScreenDef.Height,0xC0,0xFF,NULL);
  1175.  
  1176.             memcpy(&BackRPort[CurrentWid],GLWindow[CurrentWid]->RPort,sizeof(struct RastPort));
  1177.             BackRPort[CurrentWid].BitMap= &BackBitMap[CurrentWid];
  1178.             }
  1179.  
  1180. d141 1
  1181. a141 2
  1182.                 FreeRaster(BackBitMap[CurrentWid].Planes[dd],
  1183.                                                         (ULONG)ScreenDef.Width,(ULONG)ScreenDef.Height);
  1184. a157 2
  1185.     RGBmodeSet[CurrentWid]=RGBmodeOn[CurrentWid];
  1186.  
  1187. a170 2
  1188.     long x,y;
  1189.  
  1190. a174 4
  1191.             /* make sure any window movements/sizing taken care of */
  1192.             update_queue(-1);
  1193.  
  1194.             /* update to make visible */
  1195. a177 1
  1196.             /* swap bitmaps */
  1197. a179 4
  1198.  
  1199.             if(DrawRPort->BitMap==swap)
  1200.                 GL_error("swapbuffers() software error, bitmaps are the same");
  1201.  
  1202. d184 1
  1203. a184 8
  1204.  
  1205.             GLWindow[CurrentWid]->RPort->BitMap=VisibleRPort->BitMap;
  1206.  
  1207.             if(RedoBorder[CurrentWid])
  1208.                 {
  1209.                 drawborder(CurrentWid);
  1210.                 RedoBorder[CurrentWid]=FALSE;
  1211.                 }
  1212. d188 1
  1213. a188 1
  1214.             deactivate_clipping(CurrentWid);
  1215. d192 1
  1216. a192 2
  1217.             BltBitMap(DrawRPort->BitMap,0,0,VisibleRPort->BitMap,0,0,CurrentWidth,CurrentHeight,
  1218.                                                                                         0xC0,0xFF,NULL);
  1219. d195 1
  1220. a195 12
  1221.             if(COOL_BORDERS && Bordered[CurrentWid])
  1222.                 {
  1223.                 x=BorderWidth;
  1224.                 y=BorderWidth+BorderHeight;
  1225.                 }
  1226.             else
  1227.                 {
  1228.                 x=0;
  1229.                 y=0;
  1230.                 }
  1231.  
  1232.             ClipBlit(DrawRPort,x,y,VisibleRPort,x,y,CurrentWidth,CurrentHeight,0xC0);
  1233. d197 1
  1234. a197 1
  1235.             activate_clipping(CurrentWid);
  1236. d278 1
  1237. a278 1
  1238.         get_dimensions(CurrentWid,FALSE,&CurrentPosX,&CurrentPosY,&CurrentWidth,&CurrentHeight);
  1239. d286 1
  1240. a286 1
  1241. short    get_dimensions(long wid,long whole,long *x,long *y,long *lenx,long *leny)
  1242. d288 1
  1243. a288 3
  1244.     if whole==TRUE, get whole window dimensions including border
  1245.  
  1246.     returns FALSE if window is not opened
  1247. d291 1
  1248. a291 1
  1249. short get_dimensions(long wid,long whole,long *x,long *y,long *lenx,long *leny)
  1250. d294 1
  1251. a294 1
  1252.         return FALSE;
  1253. d296 1
  1254. a296 1
  1255.     if(COOL_BORDERS || !Bordered[wid])
  1256. d310 1
  1257. a310 3
  1258.     *y=ScreenDef.Height-(*y)- *leny;
  1259.  
  1260. #if COOL_BORDERS
  1261. d312 1
  1262. a312 12
  1263.     if(Bordered[wid] && !whole)
  1264.         {
  1265.         *x+=BorderWidth;
  1266.         *y+=BorderWidth;
  1267.  
  1268.         *lenx-=2*BorderWidth;
  1269.         *leny-=2*BorderWidth+BorderHeight;
  1270.         }
  1271.  
  1272. #endif
  1273.  
  1274.     return TRUE;
  1275. a374 1
  1276.     NextSizeable=FALSE;
  1277. a384 9
  1278.     if(!NextWindow_Initialized)
  1279.         initialize_nextwindow();
  1280.  
  1281. #if COOL_BORDERS
  1282.  
  1283.     prefposition(BorderWidth,BorderWidth+x-1,BorderWidth,BorderWidth+BorderHeight+y-1);
  1284.  
  1285. #else
  1286.  
  1287. a387 4
  1288.  
  1289. #endif
  1290.  
  1291.     NextSizeable=TRUE;
  1292. a400 4
  1293.     NextBordered=FALSE;
  1294.  
  1295. #if !COOL_BORDERS
  1296.  
  1297. a401 2
  1298.  
  1299. #endif
  1300. d412 1
  1301. a412 7
  1302.     long posx,posy,lenx,leny;
  1303.     long sizex,sizey;
  1304.  
  1305. /*     printf("\nwinposition(%d,%d,%d,%d)\n",x1,x2,y1,y2); */
  1306.  
  1307.     get_dimensions(CurrentWid,FALSE,&posx,&posy,&lenx,&leny);
  1308.     posy=ScreenDef.Height-posy-leny;
  1309. d414 2
  1310. a415 10
  1311. /*     printf(" %d,%d %d,%d\n",posx,posy,lenx,leny); */
  1312.  
  1313.     sizex=abs(x2-x1)-lenx;
  1314.     sizey=abs(y2-y1)-leny;
  1315.  
  1316.     lenx+=sizex;
  1317.     leny+=sizey;
  1318.  
  1319.     y1=ScreenDef.Height-y1-leny;
  1320.     y2=ScreenDef.Height-y2-leny;
  1321. d419 1
  1322. a419 1
  1323.     if(y1<y2)
  1324. d422 2
  1325. a423 17
  1326.     x1-=posx;
  1327.     y1-=posy;
  1328.  
  1329. /*     printf(" %d,%d+%d,%d %d,%d+%d,%d\n",posx,posy,x1,y1,lenx,leny,sizex,sizey); */
  1330.  
  1331.     /* in two passes to prevent possible crossing of screen borders */
  1332.     do_move_and_resize(CurrentWid,x1<0,x1,0,sizex,0);
  1333.     do_move_and_resize(CurrentWid,y1<0,0,y1,0,sizey);
  1334.  
  1335.     winset(CurrentWid);
  1336.  
  1337.     get_dimensions(CurrentWid,FALSE,&posx,&posy,&lenx,&leny);
  1338. /*     printf(" %d,%d %d,%d ->",posx,posy,lenx,leny); */
  1339.  
  1340.     posy=ScreenDef.Height-posy-leny;
  1341.  
  1342. /*     printf("%d\n",posy); */
  1343. d439 1
  1344. a439 5
  1345.     do_move_and_resize(CurrentWid,FALSE,dx,-dy,0,0);
  1346.  
  1347.     winset(CurrentWid);
  1348.  
  1349. /*     MoveWindow(GLWindow[CurrentWid],dx,-dy); */
  1350. a450 5
  1351.  
  1352.     drawborder(CurrentWid);
  1353.  
  1354.     if(NumberWindows==1 && DoubleBufferSet[CurrentWid])
  1355.         RedoBorder[CurrentWid]=TRUE;
  1356. d505 1
  1357. a505 12
  1358.     Sizeable[wid]=NextSizeable;
  1359.     Bordered[wid]=NextBordered;
  1360.     NextSizeable=TRUE;
  1361.     NextBordered=TRUE;
  1362.     
  1363. #if COOL_BORDERS
  1364.  
  1365.     NextWindow.Flags|=BORDERLESS;
  1366.  
  1367. #endif
  1368.  
  1369.     if(Bordered[wid])
  1370. a506 10
  1371. #if COOL_BORDERS
  1372.  
  1373.         NextWindow.LeftEdge-=BorderWidth;
  1374.         NextWindow.TopEdge-=BorderWidth+BorderHeight;
  1375.  
  1376.         NextWindow.Width+=BorderWidth*2;
  1377.         NextWindow.Height+=BorderHeight+BorderWidth*2;
  1378.  
  1379. #else
  1380.  
  1381. d508 2
  1382. a515 6
  1383.  
  1384.         NextWindow.Title=TitleList[wid];
  1385.  
  1386. #endif
  1387.  
  1388.         strcpy(TitleList[wid],title);
  1389. a543 2
  1390.     Dimensions[wid]=2;
  1391.  
  1392. a544 4
  1393.  
  1394.     if(Bordered[wid])
  1395.         drawborder(wid);
  1396.  
  1397. d546 1
  1398. d557 1
  1399. a557 1
  1400. void    gexit(void)
  1401. d565 1
  1402. a565 1
  1403. void gexit(void)
  1404. d625 1
  1405. a625 2
  1406.         if(FontPtr)
  1407.             CloseFont(FontPtr);
  1408. a646 3
  1409.         BorderWidth=4;
  1410.         BorderHeight=11;
  1411.  
  1412. a649 2
  1413.             Bordered[m]=FALSE;
  1414.             RedoBorder[m]=FALSE;
  1415. d688 1
  1416. a688 1
  1417. /*             printf("HiRes Lace\n"); */
  1418. d704 1
  1419. a704 2
  1420. /*             printf("LoRes\n"); */
  1421.  
  1422. a802 1
  1423.     initialize_RGB();
  1424. d814 1
  1425. a814 1
  1426.     if(atexit(gexit))
  1427. @
  1428.  
  1429.  
  1430. 1.2.1.5
  1431. log
  1432. @added foreground() check
  1433. @
  1434. text
  1435. @d4 1
  1436. a4 1
  1437. $Id: window.c,v 1.2.1.4 1994/11/16 06:31:09 jason Exp jason $
  1438. a6 4
  1439.  * Revision 1.2.1.4  1994/11/16  06:31:09  jason
  1440.  * added border support
  1441.  * fixed double-buffering
  1442.  *
  1443. a44 2
  1444. short Foregrounded=FALSE;
  1445.  
  1446. a91 11
  1447. void    foreground(void)
  1448.  
  1449. ******************************************************************************/
  1450. /*PROTOTYPE*/
  1451. void foreground(void)
  1452.     {
  1453.     Foregrounded=TRUE;
  1454.     }
  1455.  
  1456.  
  1457. /******************************************************************************
  1458. a688 7
  1459.  
  1460.     if(!Foregrounded)
  1461.         {
  1462.         GL_error("AGL cannot background process: foreground() assumed");
  1463.  
  1464.         Foregrounded=TRUE;
  1465.         }
  1466. @
  1467.  
  1468.  
  1469. 1.2.1.6
  1470. log
  1471. @fixed bitmap crashes
  1472. @
  1473. text
  1474. @d1 1
  1475. d4 1
  1476. a4 4
  1477. Copyright © 1994 Jason Weber
  1478. All Rights Reserved
  1479.  
  1480. $Id: window.c,v 1.2.1.5 1994/11/18 07:49:22 jason Exp jason $
  1481. a6 3
  1482.  * Revision 1.2.1.5  1994/11/18  07:49:22  jason
  1483.  * added foreground() check
  1484.  *
  1485. d77 1
  1486. a77 1
  1487.             value=ScreenWidth;
  1488. d80 1
  1489. a80 1
  1490.             value=ScreenHeight;
  1491. d83 1
  1492. a83 1
  1493.             value=ScreenDeep;
  1494. d86 1
  1495. a86 1
  1496.             value=ScreenDeep;
  1497. d185 1
  1498. a185 1
  1499.                                             (long)ScreenWidth,(long)ScreenHeight,0xC0,0xFF,NULL);
  1500. d197 1
  1501. a197 1
  1502.                                         (long)ScreenWidth,(long)ScreenHeight,0xC0,0xFF,NULL);
  1503. d208 1
  1504. a208 1
  1505.                                         (long)ScreenWidth,(long)ScreenHeight,0xC0,0xFF,NULL);
  1506. a209 1
  1507. /*
  1508. a212 1
  1509. */
  1510. d231 3
  1511. a233 2
  1512.         InitBitMap(&BackBitMap[CurrentWid],(long)ScreenDeep,(long)ScreenWidth,(long)ScreenHeight);
  1513.         for(d=0;d<ScreenDeep && !abort;d++)
  1514. d235 2
  1515. a236 2
  1516.             if((BackBitMap[CurrentWid].Planes[d]=(PLANEPTR)AllocRaster((ULONG)ScreenWidth,
  1517.                                                                     (ULONG)ScreenHeight))==NULL)
  1518. d238 10
  1519. d256 1
  1520. a256 1
  1521.                                                         (ULONG)ScreenWidth,(ULONG)ScreenHeight);
  1522. a259 9
  1523. /*             clone_new_bitmap(); */
  1524.  
  1525.             BltBitMap(
  1526.                         GLScreen->RastPort.BitMap,0,0,
  1527.                         &BackBitMap[CurrentWid],0,0,
  1528.                                             (long)ScreenWidth,(long)ScreenHeight,0xC0,0xFF,NULL);
  1529.  
  1530. /*             memcpy(&BackRPort[CurrentWid],GLWindow[CurrentWid]->RPort,sizeof(struct RastPort)); */
  1531.  
  1532. d267 2
  1533. a268 2
  1534.         for(d=0;d<ScreenDeep;d++)
  1535.             FreeRaster(BackBitMap[CurrentWid].Planes[d],(ULONG)ScreenWidth,(ULONG)ScreenHeight);
  1536. d313 1
  1537. a313 1
  1538. /*             GLWindow[CurrentWid]->RPort->BitMap=VisibleRPort->BitMap; */
  1539. d317 1
  1540. a317 1
  1541.                 drawborder(CurrentWid,0);
  1542. d328 1
  1543. a328 1
  1544.                                                                                     0xC0,0xFF,NULL);
  1545. d459 1
  1546. a459 1
  1547.     *y=ScreenHeight-(*y)- *leny;
  1548. d526 1
  1549. a526 1
  1550.     NextWindow.TopEdge=    ScreenHeight-1-y2;
  1551. d600 1
  1552. a600 1
  1553.     posy=ScreenHeight-posy-leny;
  1554. d604 2
  1555. a605 2
  1556.     sizex=abs(x2-x1)+1-lenx;
  1557.     sizey=abs(y2-y1)+1-leny;
  1558. d610 2
  1559. a611 2
  1560.     y1=ScreenHeight-y1-leny;
  1561.     y2=ScreenHeight-y2-leny;
  1562. d632 1
  1563. a632 1
  1564.     posy=ScreenHeight-posy-leny;
  1565. d667 1
  1566. a667 1
  1567.     drawborder(CurrentWid,0);
  1568. a735 5
  1569.  
  1570.     Maximization[wid][0]=BorderWidth;
  1571.     Maximization[wid][1]=BorderWidth;
  1572.     Maximization[wid][2]=ScreenWidth-2*BorderWidth;
  1573.     Maximization[wid][3]=ScreenHeight-2*BorderWidth-BorderHeight;
  1574. d784 1
  1575. a784 1
  1576.     TempBuffer[wid]=(PLANEPTR)AllocRaster((ULONG)ScreenWidth,(ULONG)ScreenHeight);
  1577. d792 1
  1578. a792 1
  1579.                 InitTmpRas(&TempRaster[wid],TempBuffer[wid],RASSIZE(ScreenWidth,ScreenHeight));
  1580. d801 1
  1581. a801 1
  1582.         drawborder(wid,0);
  1583. d864 1
  1584. a864 1
  1585.         FreeRaster(TempBuffer[wid],(ULONG)ScreenWidth,(ULONG)ScreenHeight);
  1586. a982 4
  1587.         ScreenWidth=ScreenDef.Width;
  1588.         ScreenHeight=ScreenDef.Height;
  1589.         ScreenDeep=ScreenDef.Depth;
  1590.  
  1591. d999 1
  1592. a999 1
  1593.     colors=pow(2.0,(float)ScreenDeep);
  1594. a1060 3
  1595.  
  1596.     ScreenWidth=GLScreen->Width;
  1597.     ScreenHeight=GLScreen->Height;
  1598. @
  1599.